package com.cskaoyan.dbutils.resultsetHandler;

import com.cskaoyan.opensource.DBCPUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.MapListHandler;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * 创建日期: 2022/11/19 09:41
 *
 * @author ciggar
 */
public class MapListHandlerDemo {

    public static void main(String[] args) throws SQLException {

        // 1. 构建QueryRunner
        QueryRunner queryRunner = new QueryRunner(DBCPUtils.getDataSource());

        // 2. 执行SQL
        List<Map<String, Object>> mapList = queryRunner.query("select * from account where id between ? and ?", new MapListHandler(), 1001, 2001);

        System.out.println(mapList);
    }
}
